package com.pwc.conversionTool.dataAdaptor;

import java.util.ArrayList;
import java.util.List;

public abstract class BaseUtil implements IDataAdaptor {

	
	protected String[] header;

	protected List<String[]> content;
	
	protected void renameHeaderSameName() {
		List<String> result=new ArrayList<String>();
		
		if(this.header!=null)
		{
			for(int i=0;i<this.header.length;i++)
			{
				int equalTimes=0;
				String value=header[i];
				for (String item : result) {
					if(value.equals(item))
					{
						equalTimes++;
						value=header[i]+"("+equalTimes+")";
					}
				}
				
				if(equalTimes==0)
				{
					result.add(header[i]);
				}else {
					result.add(header[i]+"("+equalTimes+")");
				}
				
			}
			
			this.header=result.toArray(header);
		}
		
	}
}
